import request from '@/utils/request';

//空运
export async function querySearch(params) {
  return request(`${PORTAL_PATH}/api/air/quotations`, {
    params,
  });
}

//海运
export async function queryOceanShipping(params) {
  return request(+`${LOGISTICS_PATH}/web/quotation`, {
    params,
  });
}

export async function removeSearch(params) {
  return request('/api/search/list', {
    method: 'POST',
    data: { ...params, method: 'delete' },
  });
}

export async function addSearch(params) {
  return request('/api/search/list', {
    method: 'POST',
    data: { ...params, method: 'post' },
  });
}

export async function updateSearch(params) {
  return request('/api/search/list', {
    method: 'POST',
    data: { ...params, method: 'update' },
  });
}

/**
 * 获取区域
 * @param status
 * @returns {Promise.<void>}
 */
export async function getAreaTree() {
  return request(BASEDATA_PATH + '/api/area/tree', {
    method: 'get',
  });
}

/**
 * 根据区编码获取街道
 * @param districtCode
 * @return
 */
export async function getAreaStreetsTree({ districtCode }) {
  return request(BASEDATA_PATH + '/api/streets/' + districtCode, {
    method: 'get',
    data: { districtCode },
  });
}
